package com.mg.game;

import android.graphics.Bitmap;
import android.graphics.Canvas;

import com.mg.framework.kernel.Actor;
import com.mg.framework.kernel.Screen;

public class Cloud extends Actor {

	private int speed = 0;
	
	public Cloud(Screen screen, Bitmap bitmap) {
		super(screen, bitmap);
		this.setX((int)(Math.random() * this.screen.getWidth()));
		this.setY((int)(Math.random() * this.screen.getHeight()));
		this.speed = (int)(Math.random() * 2 + 1);
	}

	@Override
	public void gameUpdate() {
		if (this.getX() >= (this.screen.getWidth() + 100)){
			this.setX(-100 - this.width);
			this.setY((int)(Math.random() * this.screen.getHeight()));
			this.speed = (int)(Math.random() * 2 + 1);
		}
		this.addX(speed);
	}

	@Override
	public void screenUpdate(Canvas canvas) {
		this.drawSelf(canvas, null);
	}
}
